"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/' /* html or false to disable */
}, pp_settings);
// Global variables accessible only by prettyPhoto
var matchedObjects = this, percentBased = false, pp_dimensions, pp_open,
// prettyPhoto container specific
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
// Window size
windowHeight = $(window).height(), windowWidth = $(window).width(),
// Global elements
pp_slideshow;
doresize = true, scroll_pos = _get_scroll();
// Window/Keyboard events
$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){ _center_overlay(); _resize_overlay(); });
if(pp_settings.keyboard_shortcuts) {
$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){
if(typeof $pp_pic_holder != 'undefined'){
if($pp_pic_holder.is(':visible')){
switch(e.keyCode){
case 37:
$.prettyPhoto.changePage('previous');
e.preventDefault();
break;
case 39:
$.prettyPhoto.changePage('next');
e.preventDefault();
break;
case 27:
if(!settings.modal)
$.prettyPhoto.close();
e.preventDefault();
break;
};
// return false;
};
};
});
};
/**
* Initialize prettyPhoto.
*/
$.prettyPhoto.initialize = function() {
settings = pp_settings;
if(settings.theme == 'pp_default') settings.horizontal_padding = 16;
if(settings.ie6_fallback && $.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
// Find out if the picture is part of a set
theRel = $(this).attr(settings.hook);
galleryRegExp = /\[(?:.*)\]/;
isSet = (galleryRegExp.exec(theRel)) ? true : false;
// Put the SRCs, TITLEs, ALTs into an array.
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(this).attr('href'));
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(this).find('img').attr('alt'));
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr(settings.hook).indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(this).attr('title'));
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery = false;
set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
rel_index = (isSet) ? set_position : $("a["+settings.hook+"^='"+theRel+"']").index($(this));
_build_overlay(this); // Build the overlay {this} being the caller
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){ _center_overlay(); });
$.prettyPhoto.open();
return false;
}
/**
* Opens the prettyPhoto modal box.
* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
*/
$.prettyPhoto.open = function(event) {
if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
settings = pp_settings;
if($.browser.msie && $.browser.version == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
pp_images = $.makeArray(arguments[0]);
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
isSet = (pp_images.length > 1) ? true : false;
set_position = (arguments[3])? arguments[3]: 0;
_build_overlay(event.target); // Build the overlay {this} being the caller
}
if($.browser.msie && $.browser.version == 6) $('select').css('visibility','hidden'); // To fix the bug with IE select boxes
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden'); // Hide the flash
_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
$('.pp_loaderIcon').show();
if(settings.deeplinking)
setHashtag();
// Rebuild Facebook Like Button with updated href
if(settings.social_tools){
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
}
// Fade the content in
if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
// Display the current position
$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
// Set the description
if(typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != ""){
$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
}else{
$pp_pic_holder.find('.pp_description').hide();
}
// Get the dimensions
movie_width = ( parseFloat(getParam('width',pp_images[set_position])) ) ? getParam('width',pp_images[set_position]) : settings.default_width.toString();
movie_height = ( parseFloat(getParam('height',pp_images[set_position])) ) ? getParam('height',pp_images[set_position]) : settings.default_height.toString();
// If the size is % based, calculate according to window dimensions
percentBased=false;
if(movie_height.indexOf('%') != -1) { movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); percentBased = true; }
if(movie_width.indexOf('%') != -1) { movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); percentBased = true; }
// Fade the holder
$pp_pic_holder.fadeIn(function(){
// Set the title
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' ');
imgPreloader = "";
skipInjection = false;
// Inject the proper content
switch(_getFileType(pp_images[set_position])){
case 'image':
imgPreloader = new Image();
// Preload the neighbour images
nextImage = new Image();
if(isSet && set_position < $(pp_images).size() -1) nextImage.src = pp_images[set_position + 1];
prevImage = new Image();
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g,pp_images[set_position]);
imgPreloader.onload = function(){
// Fit item to viewport
pp_dimensions = _fitToViewport(imgPreloader.width,imgPreloader.height);
_showContent();
};
imgPreloader.onerror = function(){
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
$.prettyPhoto.close();
};
imgPreloader.src = pp_images[set_position];
break;
case 'youtube':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
// Regular youtube link
movie_id = getParam('v',pp_images[set_position]);
// youtu.be link
if(movie_id == ""){
movie_id = pp_images[set_position].split('youtu.be/');
movie_id = movie_id[1];
if(movie_id.indexOf('?') > 0)
movie_id = movie_id.substr(0,movie_id.indexOf('?')); // Strip anything after the ?
if(movie_id.indexOf('&') > 0)
movie_id = movie_id.substr(0,movie_id.indexOf('&')); // Strip anything after the &
}
movie = 'http://www.youtube.com/embed/'+movie_id;
(getParam('rel',pp_images[set_position])) ? movie+="?rel="+getParam('rel',pp_images[set_position]) : movie+="?rel=1";
if(settings.autoplay) movie += "&autoplay=1";
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
break;
case 'vimeo':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
movie_id = pp_images[set_position];
var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/;
var match = movie_id.match(regExp);
movie = 'http://player.vimeo.com/video/'+ match[2] +'?title=0&byline=0&portrait=0';
if(settings.autoplay) movie += "&autoplay=1;";
vimeo_width = pp_dimensions['width'] + '/embed/?moog_width='+ pp_dimensions['width'];
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);
break;
case 'quicktime':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
pp_dimensions['height']+=15; pp_dimensions['contentHeight']+=15; pp_dimensions['containerHeight']+=15; // Add space for the control bar
toInject = settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
break;
case 'flash':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
flash_vars = pp_images[set_position];
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
filename = pp_images[set_position];
filename = filename.substring(0,filename.indexOf('?'));
toInject = settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
break;
case 'iframe':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
frame_url = pp_images[set_position];
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
toInject = settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);
break;
case 'ajax':
doresize = false; // Make sure the dimensions are not resized.
pp_dimensions = _fitToViewport(movie_width,movie_height);
doresize = true; // Reset the dimensions
skipInjection = true;
$.get(pp_images[set_position],function(responseHTML){
toInject = settings.inline_markup.replace(/{content}/g,responseHTML);
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
_showContent();
});
break;
case 'custom':
pp_dimensions = _fitToViewport(movie_width,movie_height); // Fit item to viewport
toInject = settings.custom_markup;
break;
case 'inline':
// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
myClone = $(pp_images[set_position]).clone().append(' ').css({'width':settings.default_width}).wrapInner('
').appendTo($('body')).show();
doresize = false; // Make sure the dimensions are not resized.
pp_dimensions = _fitToViewport($(myClone).width(),$(myClone).height());
doresize = true; // Reset the dimensions
$(myClone).remove();
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
break;
};
if(!imgPreloader && !skipInjection){
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
// Show content
_showContent();
};
});
return false;
};
/**
* Change page in the prettyPhoto modal box
* @param direction {String} Direction of the paging, previous or next.
*/
$.prettyPhoto.changePage = function(direction){
currentGalleryPage = 0;
if(direction == 'previous') {
set_position--;
if (set_position < 0) set_position = $(pp_images).size()-1;
}else if(direction == 'next'){
set_position++;
if(set_position > $(pp_images).size()-1) set_position = 0;
}else{
set_position=direction;
};
rel_index = set_position;
if(!doresize) doresize = true; // Allow the resizing of the images
if(settings.allow_expand) {
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
}
_hideContent(function(){ $.prettyPhoto.open(); });
};
/**
* Change gallery page in the prettyPhoto modal box
* @param direction {String} Direction of the paging, previous or next.
*/
$.prettyPhoto.changeGalleryPage = function(direction){
if(direction=='next'){
currentGalleryPage ++;
if(currentGalleryPage > totalPage) currentGalleryPage = 0;
}else if(direction=='previous'){
currentGalleryPage --;
if(currentGalleryPage < 0) currentGalleryPage = totalPage;
}else{
currentGalleryPage = direction;
};
slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0;
slide_to = currentGalleryPage * (itemsPerPage * itemWidth);
$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);
};
/**
* Start the slideshow...
*/
$.prettyPhoto.startSlideshow = function(){
if(typeof pp_slideshow == 'undefined'){
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
$.prettyPhoto.stopSlideshow();
return false;
});
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
}else{
$.prettyPhoto.changePage('next');
};
}
/**
* Stop the slideshow...
*/
$.prettyPhoto.stopSlideshow = function(){
$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
clearInterval(pp_slideshow);
pp_slideshow=undefined;
}
/**
* Closes prettyPhoto.
*/
$.prettyPhoto.close = function(){
if($pp_overlay.is(":animated")) return;
$.prettyPhoto.stopSlideshow();
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
$pp_overlay.fadeOut(settings.animation_speed, function(){
if($.browser.msie && $.browser.version == 6) $('select').css('visibility','visible'); // To fix the bug with IE select boxes
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible'); // Show the flash
$(this).remove(); // No more need for the prettyPhoto markup
$(window).unbind('scroll.prettyphoto');
clearHashtag();
settings.callback();
doresize = true;
pp_open = false;
delete settings;
});
};
/**
* Set the proper sizes on the containers and animate the content in.
*/
function _showContent(){
$('.pp_loaderIcon').hide();
// Calculate the opened top position of the pic holder
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (pp_dimensions['containerHeight']/2));
if(projectedTop < 0) projectedTop = 0;
$ppt.fadeTo(settings.animation_speed,1);
// Resize the content holder
$pp_pic_holder.find('.pp_content')
.animate({
height:pp_dimensions['contentHeight'],
width:pp_dimensions['contentWidth']
},settings.animation_speed);
// Resize picture the holder
$pp_pic_holder.animate({
'top': projectedTop,
'left': ((windowWidth/2) - (pp_dimensions['containerWidth']/2) < 0) ? 0 : (windowWidth/2) - (pp_dimensions['containerWidth']/2),
width:pp_dimensions['containerWidth']
},settings.animation_speed,function(){
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
// Show the nav
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
if(settings.allow_expand) {
if(pp_dimensions['resized']){ // Fade the resizing link if the image is resized
$('a.pp_expand,a.pp_contract').show();
}else{
$('a.pp_expand').hide();
}
}
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
settings.changepicturecallback(); // Callback!
pp_open = true;
});
_insert_gallery();
pp_settings.ajaxcallback();
};
/**
* Hide the content...DUH!
*/
function _hideContent(callback){
// Fade out the current picture
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
$('.pp_loaderIcon').show();
callback();
});
};
/**
* Check the item position in the gallery array, hide or show the navigation links
* @param setCount {integer} The total number of items in the set
*/
function _checkPosition(setCount){
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
};
/**
* Resize the item dimensions if it's bigger than the viewport
* @param width {integer} Width of the item to be opened
* @param height {integer} Height of the item to be opened
* @return An array containin the "fitted" dimensions
*/
function _fitToViewport(width,height){
resized = false;
_getDimensions(width,height);
// Define them in case there's no resize needed
imageWidth = width, imageHeight = height;
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
resized = true, fitting = false;
while (!fitting){
if((pp_containerWidth > windowWidth)){
imageWidth = (windowWidth - 200);
imageHeight = (height/width) * imageWidth;
}else if((pp_containerHeight > windowHeight)){
imageHeight = (windowHeight - 200);
imageWidth = (width/height) * imageHeight;
}else{
fitting = true;
};
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
};
_getDimensions(imageWidth,imageHeight);
if((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)){
_fitToViewport(pp_containerWidth,pp_containerHeight)
};
};
return {
width:Math.floor(imageWidth),
height:Math.floor(imageHeight),
containerHeight:Math.floor(pp_containerHeight),
containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2),
contentHeight:Math.floor(pp_contentHeight),
contentWidth:Math.floor(pp_contentWidth),
resized:resized
};
};
/**
* Get the containers dimensions according to the item size
* @param width {integer} Width of the item to be opened
* @param height {integer} Height of the item to be opened
*/
function _getDimensions(width,height){
width = parseFloat(width);
height = parseFloat(height);
// Get the details height, to do so, I need to clone it since it's invisible
$pp_details = $pp_pic_holder.find('.pp_details');
$pp_details.width(width);
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
$pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
'position':'absolute',
'top':-10000
});
detailsHeight += $pp_details.height();
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
if($.browser.msie && $.browser.version==7) detailsHeight+=8;
$pp_details.remove();
// Get the titles height, to do so, I need to clone it since it's invisible
$pp_title = $pp_pic_holder.find('.ppt');
$pp_title.width(width);
titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
$pp_title = $pp_title.clone().appendTo($('body')).css({
'position':'absolute',
'top':-10000
});
titleHeight += $pp_title.height();
$pp_title.remove();
// Get the container size, to resize the holder to the right dimensions
pp_contentHeight = height + detailsHeight;
pp_contentWidth = width;
pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
pp_containerWidth = width;
}
function _getFileType(itemSrc){
if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) {
return 'youtube';
}else if (itemSrc.match(/vimeo\.com/i)) {
return 'vimeo';
}else if(itemSrc.match(/\b.mov\b/i)){
return 'quicktime';
}else if(itemSrc.match(/\b.swf\b/i)){
return 'flash';
}else if(itemSrc.match(/\biframe=true\b/i)){
return 'iframe';
}else if(itemSrc.match(/\bajax=true\b/i)){
return 'ajax';
}else if(itemSrc.match(/\bcustom=true\b/i)){
return 'custom';
}else if(itemSrc.substr(0,1) == '#'){
return 'inline';
}else{
return 'image';
};
};
function _center_overlay(){
if(doresize && typeof $pp_pic_holder != 'undefined') {
scroll_pos = _get_scroll();
contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
if(projectedTop < 0) projectedTop = 0;
if(contentHeight > windowHeight)
return;
$pp_pic_holder.css({
'top': projectedTop,
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
});
};
};
function _get_scroll(){
if (self.pageYOffset) {
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
} else if (document.body) {// all other Explorers
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
};
};
function _resize_overlay() {
windowHeight = $(window).height(), windowWidth = $(window).width();
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height()).width(windowWidth);
};
function _insert_gallery(){
if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image" && (settings.ie6_fallback && !($.browser.msie && parseInt($.browser.version) == 6))) {
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; // Define the arrow width depending on the theme
itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth);
itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
// Hide the nav in the case there's no need for links
if(totalPage == 0){
navWidth = 0; // No nav means no width!
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
}else{
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
};
galleryWidth = itemsPerPage * itemWidth;
fullGalleryWidth = pp_images.length * itemWidth;
// Set the proper width to the gallery items
$pp_gallery
.css('margin-left',-((galleryWidth/2) + (navWidth/2)))
.find('div:first').width(galleryWidth+5)
.find('ul').width(fullGalleryWidth)
.find('li.selected').removeClass('selected');
goToPage = (Math.floor(set_position/itemsPerPage) < totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
$.prettyPhoto.changeGalleryPage(goToPage);
$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');
}else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
// $pp_gallery.hide();
}
}
function _build_overlay(caller){
// Inject Social Tool markup into General markup
if(settings.social_tools)
facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
settings.markup = settings.markup.replace('{pp_social}','');
$('body').append(settings.markup); // Inject the markup
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay'); // Set my global selectors
// Inject the inline gallery!
if(isSet && settings.overlay_gallery) {
currentGalleryPage = 0;
toInject = "";
for (var i=0; i < pp_images.length; i++) {
if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
classname = 'default';
img_src = '';
}else{
classname = '';
img_src = pp_images[i];
}
toInject += "
";
};
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
$pp_pic_holder.find('#pp_full_res').after(toInject);
$pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); // Set the gallery selectors
$pp_gallery.find('.pp_arrow_next').click(function(){
$.prettyPhoto.changeGalleryPage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_gallery.find('.pp_arrow_previous').click(function(){
$.prettyPhoto.changeGalleryPage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_content').hover(
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
},
function(){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
});
itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
$pp_gallery_li.each(function(i){
$(this)
.find('a')
.click(function(){
$.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow();
return false;
});
});
};
// Inject the play/pause if it's a slideshow
if(settings.slideshow){
$pp_pic_holder.find('.pp_nav').prepend('Play')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
}
$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
$pp_overlay
.css({
'opacity':0,
'height':$(document).height(),
'width':$(window).width()
})
.bind('click',function(){
if(!settings.modal) $.prettyPhoto.close();
});
$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
if(settings.allow_expand) {
$('a.pp_expand').bind('click',function(e){
// Expand the image
if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract');
doresize = false;
}else{
$(this).removeClass('pp_contract').addClass('pp_expand');
doresize = true;
};
_hideContent(function(){ $.prettyPhoto.open(); });
return false;
});
}
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
$.prettyPhoto.changePage('previous');
$.prettyPhoto.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
$.prettyPhoto.changePage('next');
$.prettyPhoto.stopSlideshow();
return false;
});
_center_overlay(); // Center it
};
if(!pp_alreadyInitialized && getHashtag()){
pp_alreadyInitialized = true;
// Grab the rel index to trigger the click on the correct element
hashIndex = getHashtag();
hashRel = hashIndex;
hashIndex = hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);
hashRel = hashRel.substring(0,hashRel.indexOf('/'));
// Little timeout to make sure all the prettyPhoto initialize scripts has been run.
// Useful in the event the page contain several init scripts.
setTimeout(function(){ $("a["+pp_settings.hook+"^='"+hashRel+"']:eq("+hashIndex+")").trigger('click'); },50);
}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
};
function getHashtag(){
url = location.href;
hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto')+1,url.length)) : false;
return hashtag;
};
function setHashtag(){
if(typeof theRel == 'undefined') return; // theRel is set on normal calls, it's impossible to deeplink using the API
location.hash = theRel + '/'+rel_index+'/';
};
function clearHashtag(){
if ( location.href.indexOf('#prettyPhoto') !== -1 ) location.hash = "prettyPhoto";
}
function getParam(name,url){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return ( results == null ) ? "" : results[1];
}
})(jQuery);
var pp_alreadyInitialized = false; // Used for the deep linking to make sure not to call the same function several times.;
// source --> https://esquipa.com.br/wp-content/themes/CherryFramework/js/jquery.elastislide.js?ver=1.0
(function( window, $, undefined ) {
// http://www.netcu.de/jquery-touchwipe-iphone-ipad-library
$.fn.touchwipe = function(settings) {
var config = {
min_move_x: 20,
min_move_y: 20,
wipeLeft: function() { },
wipeRight: function() { },
wipeUp: function() { },
wipeDown: function() { },
preventDefaultEvents: true
};
if (settings) $.extend(config, settings);
this.each(function() {
var startX;
var startY;
var isMoving = false;
function cancelTouch() {
this.removeEventListener('touchmove', onTouchMove);
startX = null;
isMoving = false;
}
function onTouchMove(e) {
if(config.preventDefaultEvents) {
e.preventDefault();
}
if(isMoving) {
var x = e.touches[0].pageX;
var y = e.touches[0].pageY;
var dx = startX - x;
var dy = startY - y;
if(Math.abs(dx) >= config.min_move_x) {
cancelTouch();
if(dx > 0) {
config.wipeLeft();
}
else {
config.wipeRight();
}
}
else if(Math.abs(dy) >= config.min_move_y) {
cancelTouch();
if(dy > 0) {
config.wipeDown();
}
else {
config.wipeUp();
}
}
}
}
function onTouchStart(e)
{
if (e.touches.length == 1) {
startX = e.touches[0].pageX;
startY = e.touches[0].pageY;
isMoving = true;
this.addEventListener('touchmove', onTouchMove, false);
}
}
if ('ontouchstart' in document.documentElement) {
this.addEventListener('touchstart', onTouchStart, false);
}
});
return this;
};
$.elastislide = function( options, element ) {
this.$el = $( element );
this._init( options );
};
$.elastislide.defaults = {
speed : 450, // animation speed
easing : 'easeOutBack', // animation easing effect
imageW : 190, // the images width
margin : 3, // image margin right
border : 2, // image border
minItems : 1, // the minimum number of items to show.
// when we resize the window, this will make sure minItems are always shown
// (unless of course minItems is higher than the total number of elements)
current : 0, // index of the current item
// when we resize the window, the carousel will make sure this item is visible
onClick : function() { return false; } // click item callback
};
$.elastislide.prototype = {
_init : function( options ) {
this.options = $.extend( true, {}, $.elastislide.defaults, options );
//
this.$slider = this.$el.find('ul');
//
this.$items = this.$slider.children('li');
// total number of elements / images
this.itemsCount = this.$items.length;
// cache the
's parent, since we will eventually need to recalculate its width on window resize
this.$esCarousel = this.$slider.parent();
// validate options
this._validateOptions();
// set sizes and initialize some vars...
this._configure();
// add navigation buttons
this._addControls();
// initialize the events
this._initEvents();
// show the
this.$slider.show();
// slide to current's position
this._slideToCurrent( false );
},
_validateOptions : function() {
if( this.options.speed < 0 )
this.options.speed = 450;
if( this.options.margin < 0 )
this.options.margin = 4;
if( this.options.border < 0 )
this.options.border = 1;
if( this.options.minItems < 1 || this.options.minItems > this.itemsCount )
this.options.minItems = 1;
if( this.options.current > this.itemsCount - 1 )
this.options.current = 0;
},
_configure : function() {
// current item's index
this.current = this.options.current;
// the ul's parent's (div.es-carousel) width is the "visible" width
this.visibleWidth = this.$esCarousel.width();
// test to see if we need to initially resize the items
if( this.visibleWidth < this.options.minItems * ( this.options.imageW + 2 * this.options.border ) + ( this.options.minItems - 1 ) * this.options.margin ) {
this._setDim( ( this.visibleWidth - ( this.options.minItems - 1 ) * this.options.margin ) / this.options.minItems );
this._setCurrentValues();
// how many items fit with the current width
this.fitCount = this.options.minItems;
}
else {
this._setDim();
this._setCurrentValues();
}
// set the
','');
}
}
// Add Image Sizes
// http://www.flickr.com/services/api/misc.urls.html
item['image_s'] = item.media.m.replace('_m', '_s');
item['image_t'] = item.media.m.replace('_m', '_t');
item['image_m'] = item.media.m.replace('_m', '_m');
item['image'] = item.media.m.replace('_m', '');
item['image_b'] = item.media.m.replace('_m', '_b');
delete item.media;
// Use Template
if(settings.useTemplate){
var template = settings.itemTemplate;
for(var key in item){
var rgx = new RegExp('{{' + key + '}}', 'g');
template = template.replace(rgx, item[key]);
}
$container.append(template)
}
//itemCallback
settings.itemCallback.call(container, item);
}
});
if($.isFunction(callback)){
callback.call(container, data);
}
});
});
}
})(jQuery);
// source --> https://esquipa.com.br/wp-content/themes/CherryFramework/js/si.files.js?ver=1.0
// STYLING FILE INPUTS 1.0 | Shaun Inman | 2007-09-07
if (!window.SI) { var SI = {}; };
SI.Files =
{
htmlClass : 'SI-FILES-STYLIZED',
fileClass : 'file',
wrapClass : 'cabinet',
fini : false,
able : false,
init : function()
{
this.fini = true;
var ie = 0 //@cc_on + @_jscript_version
if (window.opera || (ie && ie < 5.5) || !document.getElementsByTagName) { return; } // no support for opacity or the DOM
this.able = true;
var html = document.getElementsByTagName('html')[0];
html.className += (html.className != '' ? ' ' : '') + this.htmlClass;
},
stylize : function(elem)
{
if (!this.fini) { this.init(); };
if (!this.able) { return; };
elem.parentNode.file = elem;
elem.parentNode.onmousemove = function(e)
{
if (typeof e == 'undefined') e = window.event;
if (typeof e.pageY == 'undefined' && typeof e.clientX == 'number' && document.documentElement)
{
e.pageX = e.clientX + document.documentElement.scrollLeft;
e.pageY = e.clientY + document.documentElement.scrollTop;
};
var ox = oy = 0;
var elem = this;
if (elem.offsetParent)
{
ox = elem.offsetLeft;
oy = elem.offsetTop;
while (elem = elem.offsetParent)
{
ox += elem.offsetLeft;
oy += elem.offsetTop;
};
};
var x = e.pageX - ox;
var y = e.pageY - oy;
var w = this.file.offsetWidth;
var h = this.file.offsetHeight;
this.file.style.top = y - (h / 2) + 'px';
this.file.style.left = x - (w - 30) + 'px';
};
},
stylizeById : function(id)
{
this.stylize(document.getElementById(id));
},
stylizeAll : function()
{
if (!this.fini) { this.init(); };
if (!this.able) { return; };
var inputs = document.getElementsByTagName('input');
for (var i = 0; i < inputs.length; i++)
{
var input = inputs[i];
if (input.type == 'file' && input.className.indexOf(this.fileClass) != -1 && input.parentNode.className.indexOf(this.wrapClass) != -1)
{
this.stylize(input);
};
};
}
};
// source --> https://esquipa.com.br/wp-content/themes/CherryFramework/js/camera.js?ver=1.3.3
// Camera slideshow v1.3.3 - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.4+
// Copyright (c) 2012 by Manuel Masia - www.pixedelic.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
;(function($){$.fn.camera = function(opts, callback) {
var defaults = {
alignment : 'topCenter', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
autoAdvance : true, //true, false
mobileAutoAdvance : true, //true, false. Auto-advancing for mobile devices
barDirection : 'leftToRight', //'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop'
barPosition : 'bottom', //'bottom', 'left', 'top', 'right'
cols : 6,
easing : 'easeInOutExpo', //for the complete list http://jqueryui.com/demos/effect/easing.html
mobileEasing : '', //leave empty if you want to display the same easing on mobile devices and on desktop etc.
fx : 'random', //'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight'
//you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom'
mobileFx : '', //leave empty if you want to display the same effect on mobile devices and on desktop etc.
gridDifference : 250, //to make the grid blocks slower than the slices, this value must be smaller than transPeriod
height : '50%', //here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
imagePath : 'images/', //he path to the image folder (it serves for the blank.gif, when you want to display videos)
hover : true, //true, false. Puase on state hover. Not available for mobile devices
loader : 'pie', //pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar)
loaderColor : '#eeeeee',
loaderBgColor : '#222222',
loaderOpacity : .8, //0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
loaderPadding : 2, //how many empty pixels you want to display between the loader and its background
loaderStroke : 7, //the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter
minHeight : '200px', //you can also leave it blank
navigation : true, //true or false, to display or not the navigation buttons
navigationHover : true, //if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
mobileNavHover : true, //same as above, but only for mobile devices
opacityOnGrid : false, //true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect
overlayer : true, //a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
pagination : true,
playPause : true, //true or false, to display or not the play/pause buttons
pauseOnClick : true, //true, false. It stops the slideshow when you click the sliders.
pieDiameter : 38,
piePosition : 'rightTop', //'rightTop', 'leftTop', 'leftBottom', 'rightBottom'
portrait : false, //true, false. Select true if you don't want that your images are cropped
rows : 4,
slicedCols : 12, //if 0 the same value of cols
slicedRows : 8, //if 0 the same value of rows
slideOn : 'random', //next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
thumbnails : false,
time : 7000, //milliseconds between the end of the sliding effect and the start of the nex one
transPeriod : 1500, //lenght of the sliding effect in milliseconds
////////callbacks
onEndTransition : function() { }, //this callback is invoked when the transition effect ends
onLoaded : function() { }, //this callback is invoked when the image on a slide has completely loaded
onStartLoading : function() { }, //this callback is invoked when the image on a slide start loading
onStartTransition : function() { } //this callback is invoked when the transition effect starts
};
function isMobile() {
if( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i)
){
return true;
}
}
var opts = $.extend({}, defaults, opts);
var wrap = $(this).addClass('camera_wrap');
wrap.wrapInner(
''
).wrapInner(
''
);
var fakeHover = $('.camera_fakehover',wrap);
fakeHover.append(
''
);
if(opts.overlayer == true){
fakeHover.append(
''
)
}
fakeHover.append(
''
);
var loader;
if(opts.loader=='pie' && $.browser.msie && $.browser.version < 9){
loader = 'bar';
} else {
loader = opts.loader;
}
if(loader == 'pie'){
fakeHover.append(
''
)
} else if (loader == 'bar') {
fakeHover.append(
''
)
} else {
fakeHover.append(
''
)
}
if(opts.playPause==true){
fakeHover.append(
''
)
}
if(opts.navigation==true){
fakeHover.append(
'
'
).append(
'
'
);
}
if(opts.thumbnails==true){
wrap.append(
''
);
}
if(opts.thumbnails==true && opts.pagination!=true){
$('.camera_thumbs_cont',wrap).wrap(
''
).wrap(
''
).wrap(
''
).wrap(
''
);
}
if(opts.pagination==true){
wrap.append(
''
);
}
wrap.append(
''
);
$('.camera_caption',wrap).each(function(){
$(this).wrapInner('');
});
var pieID = 'pie_'+wrap.index(),
elem = $('.camera_src',wrap),
target = $('.camera_target',wrap),
content = $('.camera_target_content',wrap),
pieContainer = $('.camera_pie',wrap),
barContainer = $('.camera_bar',wrap),
prevNav = $('.camera_prev',wrap),
nextNav = $('.camera_next',wrap),
commands = $('.camera_commands',wrap),
pagination = $('.camera_pag',wrap),
thumbs = $('.camera_thumbs_cont',wrap);
var w,
h;
var allImg = new Array();
$('> div', elem).each( function() {
allImg.push($(this).attr('data-src'));
});
var allLinks = new Array();
$('> div', elem).each( function() {
if($(this).attr('data-link')){
allLinks.push($(this).attr('data-link'));
} else {
allLinks.push('');
}
});
var allTargets = new Array();
$('> div', elem).each( function() {
if($(this).attr('data-target')){
allTargets.push($(this).attr('data-target'));
} else {
allTargets.push('');
}
});
var allPor = new Array();
$('> div', elem).each( function() {
if($(this).attr('data-portrait')){
allPor.push($(this).attr('data-portrait'));
} else {
allPor.push('');
}
});
var allAlign= new Array();
$('> div', elem).each( function() {
if($(this).attr('data-alignment')){
allAlign.push($(this).attr('data-alignment'));
} else {
allAlign.push('');
}
});
var allThumbs = new Array();
$('> div', elem).each( function() {
if($(this).attr('data-thumb')){
allThumbs.push($(this).attr('data-thumb'));
} else {
allThumbs.push('');
}
});
var amountSlide = allImg.length;
$(content).append('');
var loopMove;
for (loopMove=0;loopMove');
if(allLinks[loopMove]!=''){
//only for Wordpress plugin
var dataBox = $('> div ',elem).eq(loopMove).attr('data-box');
if(typeof dataBox !== 'undefined' && dataBox !== false && dataBox != '') {
dataBox = 'data-box="'+$('> div ',elem).eq(loopMove).attr('data-box')+'"';
} else {
dataBox = '';
}
//
$('.camera_target_content .cameraContent:eq('+loopMove+')',wrap).append('');
}
}
$('.camera_caption',wrap).each(function(){
var ind = $(this).parent().index(),
cont = wrap.find('.cameraContent').eq(ind);
$(this).appendTo(cont);
});
target.append('');
var cameraCont = $('.cameraCont',wrap);
var loop;
for (loop=0;loop');
var div = $('> div:eq('+loop+')',elem);
target.find('.cameraSlide_'+loop).clone(div);
}
function thumbnailVisible() {
var wTh = $(thumbs).width();
$('li', thumbs).removeClass('camera_visThumb');
$('li', thumbs).each(function(){
var pos = $(this).position(),
ulW = $('ul', thumbs).outerWidth(),
offUl = $('ul', thumbs).offset().left,
offDiv = $('> div',thumbs).offset().left,
ulLeft = offDiv-offUl;
if(ulLeft>0){
$('.camera_prevThumbs',camera_thumbs_wrap).removeClass('hideNav');
} else {
$('.camera_prevThumbs',camera_thumbs_wrap).addClass('hideNav');
}
if((ulW-ulLeft)>wTh){
$('.camera_nextThumbs',camera_thumbs_wrap).removeClass('hideNav');
} else {
$('.camera_nextThumbs',camera_thumbs_wrap).addClass('hideNav');
}
var left = pos.left,
right = pos.left+($(this).width());
if(right-ulLeft<=wTh && left-ulLeft>=0){
$(this).addClass('camera_visThumb');
}
});
}
$(window).bind('load resize pageshow',function(){
thumbnailPos();
thumbnailVisible();
});
cameraCont.append('');
var started;
wrap.show();
var w = target.width();
var h = target.height();
var setPause;
$(window).bind('resize pageshow',function(){
if(started == true) {
resizeImage();
}
$('ul', thumbs).animate({'margin-top':0},0,thumbnailPos);
if(!elem.hasClass('paused')){
elem.addClass('paused');
if($('.camera_stop',camera_thumbs_wrap).length){
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieID).hide();
}
} else {
if(loader!='none'){
$('#'+pieID).hide();
}
}
clearTimeout(setPause);
setPause = setTimeout(function(){
elem.removeClass('paused');
if($('.camera_play',camera_thumbs_wrap).length){
$('.camera_play',camera_thumbs_wrap).hide();
$('.camera_stop',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieID).fadeIn();
}
} else {
if(loader!='none'){
$('#'+pieID).fadeIn();
}
}
},1500);
}
});
function resizeImage(){
var res;
function resizeImageWork(){
w = wrap.width();
if(opts.height.indexOf('%')!=-1) {
var startH = Math.round(w / (100/parseFloat(opts.height)));
if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
h = parseFloat(opts.minHeight);
} else {
h = startH;
}
wrap.css({height:h});
} else if (opts.height=='auto') {
h = wrap.height();
} else {
h = parseFloat(opts.height);
wrap.css({height:h});
}
$('.camerarelative',target).css({'width':w,'height':h});
$('.imgLoaded',target).each(function(){
var t = $(this),
wT = t.attr('width'),
hT = t.attr('height'),
imgLoadIn = t.index(),
mTop,
mLeft,
alignment = t.attr('data-alignment'),
portrait = t.attr('data-portrait');
if(typeof alignment === 'undefined' || alignment === false || alignment === ''){
alignment = opts.alignment;
}
if(typeof portrait === 'undefined' || portrait === false || portrait === ''){
portrait = opts.portrait;
}
if(portrait==false||portrait=='false'){
if((wT/hT)<(w/h)) {
var r = w / wT;
var d = (Math.abs(h - (hT*r)))*0.5;
switch(alignment){
case 'topLeft':
mTop = 0;
break;
case 'topCenter':
mTop = 0;
break;
case 'topRight':
mTop = 0;
break;
case 'centerLeft':
mTop = '-'+d+'px';
break;
case 'center':
mTop = '-'+d+'px';
break;
case 'centerRight':
mTop = '-'+d+'px';
break;
case 'bottomLeft':
mTop = '-'+d*2+'px';
break;
case 'bottomCenter':
mTop = '-'+d*2+'px';
break;
case 'bottomRight':
mTop = '-'+d*2+'px';
break;
}
t.css({
'height' : hT*r,
'margin-left' : 0,
'margin-top' : mTop,
'position' : 'absolute',
'visibility' : 'visible',
'width' : w
});
}
else {
var r = h / hT;
var d = (Math.abs(w - (wT*r)))*0.5;
switch(alignment){
case 'topLeft':
mLeft = 0;
break;
case 'topCenter':
mLeft = '-'+d+'px';
break;
case 'topRight':
mLeft = '-'+d*2+'px';
break;
case 'centerLeft':
mLeft = 0;
break;
case 'center':
mLeft = '-'+d+'px';
break;
case 'centerRight':
mLeft = '-'+d*2+'px';
break;
case 'bottomLeft':
mLeft = 0;
break;
case 'bottomCenter':
mLeft = '-'+d+'px';
break;
case 'bottomRight':
mLeft = '-'+d*2+'px';
break;
}
t.css({
'height' : h,
'margin-left' : mLeft,
'margin-top' : 0,
'position' : 'absolute',
'visibility' : 'visible',
'width' : wT*r
});
}
} else {
if((wT/hT)<(w/h)) {
var r = h / hT;
var d = (Math.abs(w - (wT*r)))*0.5;
switch(alignment){
case 'topLeft':
mLeft = 0;
break;
case 'topCenter':
mLeft = d+'px';
break;
case 'topRight':
mLeft = d*2+'px';
break;
case 'centerLeft':
mLeft = 0;
break;
case 'center':
mLeft = d+'px';
break;
case 'centerRight':
mLeft = d*2+'px';
break;
case 'bottomLeft':
mLeft = 0;
break;
case 'bottomCenter':
mLeft = d+'px';
break;
case 'bottomRight':
mLeft = d*2+'px';
break;
}
t.css({
'height' : h,
'margin-left' : mLeft,
'margin-top' : 0,
'position' : 'absolute',
'visibility' : 'visible',
'width' : wT*r
});
}
else {
var r = w / wT;
var d = (Math.abs(h - (hT*r)))*0.5;
switch(alignment){
case 'topLeft':
mTop = 0;
break;
case 'topCenter':
mTop = 0;
break;
case 'topRight':
mTop = 0;
break;
case 'centerLeft':
mTop = d+'px';
break;
case 'center':
mTop = d+'px';
break;
case 'centerRight':
mTop = d+'px';
break;
case 'bottomLeft':
mTop = d*2+'px';
break;
case 'bottomCenter':
mTop = d*2+'px';
break;
case 'bottomRight':
mTop = d*2+'px';
break;
}
t.css({
'height' : hT*r,
'margin-left' : 0,
'margin-top' : mTop,
'position' : 'absolute',
'visibility' : 'visible',
'width' : w
});
}
}
});
}
if (started == true) {
clearTimeout(res);
res = setTimeout(resizeImageWork,200);
} else {
resizeImageWork();
}
started = true;
}
var u,
setT;
var clickEv,
autoAdv,
navHover,
commands,
pagination;
var videoHover,
videoPresent;
if(isMobile() && opts.mobileAutoAdvance!=''){
autoAdv = opts.mobileAutoAdvance;
} else {
autoAdv = opts.autoAdvance;
}
if(autoAdv==false){
elem.addClass('paused');
}
if(isMobile() && opts.mobileNavHover!=''){
navHover = opts.mobileNavHover;
} else {
navHover = opts.navigationHover;
}
if(elem.length!=0){
var selector = $('.cameraSlide',target);
selector.wrapInner('');
var navSlide;
var barDirection = opts.barDirection;
var camera_thumbs_wrap = wrap;
$('iframe',fakeHover).each(function(){
var t = $(this);
var src = t.attr('src');
t.attr('data-src',src);
var divInd = t.parent().index('.camera_src > div');
$('.camera_target_content .cameraContent:eq('+divInd+')',wrap).append(t);
});
function imgFake() {
$('iframe',fakeHover).each(function(){
$('.camera_caption',fakeHover).show();
var t = $(this);
var cloneSrc = t.attr('data-src');
t.attr('src',cloneSrc);
var imgFakeUrl = opts.imagePath+'blank.gif';
var imgFake = new Image();
imgFake.src = imgFakeUrl;
if(opts.height.indexOf('%')!=-1) {
var startH = Math.round(w / (100/parseFloat(opts.height)));
if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){
h = parseFloat(opts.minHeight);
} else {
h = startH;
}
} else if (opts.height=='auto') {
h = wrap.height();
} else {
h = parseFloat(opts.height);
}
t.after($(imgFake).attr({'class':'imgFake','width':w,'height':h}));
var clone = t.clone();
t.remove();
$(imgFake).bind('click',function(){
if($(this).css('position')=='absolute') {
$(this).remove();
if(cloneSrc.indexOf('vimeo') != -1 || cloneSrc.indexOf('youtube') != -1) {
if(cloneSrc.indexOf('?') != -1){
autoplay = '&autoplay=1';
} else {
autoplay = '?autoplay=1';
}
} else if(cloneSrc.indexOf('dailymotion') != -1) {
if(cloneSrc.indexOf('?') != -1){
autoplay = '&autoPlay=1';
} else {
autoplay = '?autoPlay=1';
}
}
clone.attr('src',cloneSrc+autoplay);
videoPresent = true;
} else {
$(this).css({position:'absolute',top:0,left:0,zIndex:10}).after(clone);
clone.css({position:'absolute',top:0,left:0,zIndex:9});
}
});
});
}
imgFake();
if(opts.hover==true){
if(!isMobile()){
fakeHover.hover(function(){
elem.addClass('hovered');
},function(){
elem.removeClass('hovered');
});
}
}
if(navHover==true){
$(prevNav,wrap).animate({opacity:0},0);
$(nextNav,wrap).animate({opacity:0},0);
$(commands,wrap).animate({opacity:0},0);
if(isMobile()){
fakeHover.live('vmouseover',function(){
$(prevNav,wrap).animate({opacity:1},200);
$(nextNav,wrap).animate({opacity:1},200);
$(commands,wrap).animate({opacity:1},200);
});
fakeHover.live('vmouseout',function(){
$(prevNav,wrap).delay(500).animate({opacity:0},200);
$(nextNav,wrap).delay(500).animate({opacity:0},200);
$(commands,wrap).delay(500).animate({opacity:0},200);
});
} else {
fakeHover.hover(function(){
$(prevNav,wrap).animate({opacity:1},200);
$(nextNav,wrap).animate({opacity:1},200);
$(commands,wrap).animate({opacity:1},200);
},function(){
$(prevNav,wrap).animate({opacity:0},200);
$(nextNav,wrap).animate({opacity:0},200);
$(commands,wrap).animate({opacity:0},200);
});
}
}
$('.camera_stop',camera_thumbs_wrap).live('click',function(){
autoAdv = false;
elem.addClass('paused');
if($('.camera_stop',camera_thumbs_wrap).length){
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieID).hide();
}
} else {
if(loader!='none'){
$('#'+pieID).hide();
}
}
});
$('.camera_play',camera_thumbs_wrap).live('click',function(){
autoAdv = true;
elem.removeClass('paused');
if($('.camera_play',camera_thumbs_wrap).length){
$('.camera_play',camera_thumbs_wrap).hide();
$('.camera_stop',camera_thumbs_wrap).show();
if(loader!='none'){
$('#'+pieID).show();
}
} else {
if(loader!='none'){
$('#'+pieID).show();
}
}
});
if(opts.pauseOnClick==true){
$('.camera_target_content',fakeHover).mouseup(function(){
autoAdv = false;
elem.addClass('paused');
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
$('#'+pieID).hide();
});
}
$('.cameraContent, .imgFake',fakeHover).hover(function(){
videoHover = true;
},function(){
videoHover = false;
});
$('.cameraContent, .imgFake',fakeHover).bind('click',function(){
if(videoPresent == true && videoHover == true) {
autoAdv = false;
$('.camera_caption',fakeHover).hide();
elem.addClass('paused');
$('.camera_stop',camera_thumbs_wrap).hide()
$('.camera_play',camera_thumbs_wrap).show();
$('#'+pieID).hide();
}
});
}
function shuffle(arr) {
for(
var j, x, i = arr.length; i;
j = parseInt(Math.random() * i),
x = arr[--i], arr[i] = arr[j], arr[j] = x
);
return arr;
}
function isInteger(s) {
return Math.ceil(s) == Math.floor(s);
}
if (loader != 'pie') {
barContainer.append('');
$('.camera_bar_cont',barContainer)
.animate({opacity:opts.loaderOpacity},0)
.css({'position':'absolute', 'left':0, 'right':0, 'top':0, 'bottom':0, 'background-color':opts.loaderBgColor})
.append('');
$('#'+pieID).animate({opacity:0},0);
var canvas = $('#'+pieID);
canvas.css({'position':'absolute', 'background-color':opts.loaderColor});
switch(opts.barPosition){
case 'left':
barContainer.css({right:'auto',width:opts.loaderStroke});
break;
case 'right':
barContainer.css({left:'auto',width:opts.loaderStroke});
break;
case 'top':
barContainer.css({bottom:'auto',height:opts.loaderStroke});
break;
case 'bottom':
barContainer.css({top:'auto',height:opts.loaderStroke});
break;
}
switch(barDirection){
case 'leftToRight':
canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
break;
case 'rightToLeft':
canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding});
break;
case 'topToBottom':
canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
break;
case 'bottomToTop':
canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0});
break;
}
} else {
pieContainer.append('');
var G_vmlCanvasManager;
var canvas = document.getElementById(pieID);
canvas.setAttribute("width", opts.pieDiameter);
canvas.setAttribute("height", opts.pieDiameter);
var piePosition;
switch(opts.piePosition){
case 'leftTop' :
piePosition = 'left:0; top:0;';
break;
case 'rightTop' :
piePosition = 'right:0; top:0;';
break;
case 'leftBottom' :
piePosition = 'left:0; bottom:0;';
break;
case 'rightBottom' :
piePosition = 'right:0; bottom:0;';
break;
}
canvas.setAttribute("style", "position:absolute; z-index:1002; "+piePosition);
var rad;
var radNew;
if (canvas && canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.rotate(Math.PI*(3/2));
ctx.translate(-opts.pieDiameter,0);
}
}
if(loader=='none' || autoAdv==false) {
$('#'+pieID).hide();
$('.camera_canvas_wrap',camera_thumbs_wrap).hide();
}
if($(pagination).length) {
$(pagination).append('
');
var li;
for (li = 0; li < amountSlide; li++){
$('.camera_pag_ul',wrap).append('